<template>
  <div class="add">
          <el-container>
  <el-header>
       
        <p>  我是大黑马 </p>
      <el-button type="primary" @click="cl">退出登录</el-button>


  </el-header>

  <el-container>
    <el-aside width="200px">
     
      <el-menu
     :collapse="fage"
      router
      default-active="2"
      class="el-menu-vertical-demo"
      unique-opened
      background-color="#545c64"
      text-color="#fff"
      active-text-color="#ffd04b">
       <p @click="fage=!fage" class="p1"> 222</p>
      <el-submenu :index="item.id+'' " v-for="item in data" :key="item.id" >
        <template slot="title"    >
          <i class="el-icon-location"></i>
          <span> {{item.authName}} </span>
        </template>
        <el-menu-item-group v-for="it in item.children" :key="it.id" >

          <el-menu-item :index="'/'+it.path">{{it.authName}} </el-menu-item>
    
        </el-menu-item-group>
     
   
      </el-submenu>
 
    </el-menu>

    </el-aside>



    <el-main>

      <router-view/>
    </el-main>
  </el-container>
</el-container>
  </div>
</template>

<script>


export default {
    data () {
      return {
            data:[],
            fage:false
      }
    },
    async created() {
            let { data:res }= await this.axios.get('/menus')
                this.data=res.data
                console.log(this.data);
    },
    methods: {
      cl(){
        localStorage.clear()
        this.$router.push('/dl')
      }
    },
}
</script>

<style lang="scss" scoped>
.el-header{
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: aqua;
}

.el-container{
  height: 100%;
}
.el-menu{
  height: 100%;
}
.add{
  height: 100%;
}
.el-menu{
  border-right: 0;
}

</style>
